export class Hole {
  value: number = -1
  //   采取类行列式坐标 (x,y)即 (row,column)
  x: number = 0
  y: number = 0
  state: string = 'todo'
}
export const HoleStates = [
  { state: 'todo', color: 'warning', text: '' },
  { state: 'opened', color: 'success', text: '' },
  { state: 'marked', color: 'danger', text: '#' }
]

export const nineCount = (holes: Array<Array<any>>, i: number = 0, j: number = 0) => {
  let count = 0
  for (let m = -1; m <= 1; m++) {
    for (let n = -1; n <= 1; n++) {
      // mine.holes[i+m][j+n]
      if (holes[i + m] !== undefined) {
        if (holes[i + m][j + n] !== undefined) {
          if (m === 0 && n === 0) continue
          
          if (holes[i + m][j + n].value === 9) {
            count++
          }
        }
      }
    }
  }
  return count
}
